package com.woniuxy.three.pms.hotel1.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.three.pms.bean.GuestBean;
import com.woniuxy.three.pms.bean.HotelBean;
import com.woniuxy.three.pms.dao.HotelBeanMapper;
import com.woniuxy.three.pms.hotel1.service.IHotelService;
@Service
public class HotelServiceImp implements IHotelService {
	@Autowired
	private HotelBeanMapper mapper;
	@Override
	public boolean insertHotel(HotelBean bean) {
		int num= mapper.insert(bean);
		if (num==1) {
			return true;
		}
		return false;
	}

	@Override
	public boolean delHotelById(int id) {
		int num =  mapper.deleteById(id);
		if (num==1) {
			return true;
		}
		return false;
	}

	@Override
	public List<HotelBean> findAll() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public HotelBean findByName(String name) {
		HotelBean bean = 	mapper.selectByName(name);
		return bean;
	}

	@Override
	public boolean updateHotel(HotelBean bean,String hname) {
		System.out.println("imp�е�bean:"+bean);
		System.out.println("impzhong��hid:"+hname);
	int num = mapper.updateByName(bean,hname);
	if (num==1) {
		return true;
	}
		return false;
	}

	@Override
	public List<HotelBean> showHotel() {
		  List<HotelBean> list = mapper.selectAll();
		return list;
	}

}
